home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 32 / Mac Magazin and MacEasy Magazine CD - Issue 32.iso / Grafik & Text / OzTeX3.0 / MetaPost / Docs / demo.ms < prev    next >
Text File  |  1996-08-24  |  2KB  |  106 lines

  1. .so /usr/lib/tmac/tmac.pictures
  2. .nr PS 11
  3. .nr VS 13
  4. .TL
  5. MetaPost with troff 
  6. .LP
  7. Since MetaPost is a picture-drawing language that outputs PostScript, it is
  8. necessary to use the
  9. .ft CW
  10. -mpictures
  11. .ft
  12. macro package.  Suppose you have written some figures in MetaPost and placed
  13. the input in a file \f(CWfigures.mp\fR.
  14. Running
  15. .nf
  16. .ft CW
  17.              mp -T figures
  18. .ft
  19. .fi
  20. to invoke the MetaPost interpreter produces output files
  21. \f(CWfigures.1\fR, \f(CWfigures.2\fR, .\|.\|.
  22. via macro calls such as
  23. .nf
  24. .ft CW
  25.             .BP figures.1 height width
  26. .ft
  27. .fi
  28. as explained in the
  29. .ft CW
  30. -mpictures
  31. .ft
  32. documentation. Note that the picture gets rescaled if the height and width
  33. in the \f(CW.BP\fR command don't match \fImp\fR's idea of the picture dimensions.
  34. .PP
  35. For instance,
  36. .BP figs.1 1.08i 1.5i
  37. this figure was derived from a file
  38. .ft CW
  39. figs.mp
  40. .ft
  41. and included at this point by invoking the \f(CW.BP\fR
  42. macro with height 1.08 inches and width 1.5 inches.  The macro tries to run text
  43. around the picture, but this can be stopped
  44. by using the \f(CW.EP\fR macro as was done here.
  45. .EP
  46. The file
  47. .ft CW
  48. figs.mp
  49. .ft
  50. looks like this:
  51. .nf
  52. .ft CW
  53. .nr PS 9
  54. .nr VS 11
  55. prologues:=1;
  56. input boxes
  57. beginfig(1);
  58. pair shadowshift; shadowshift=(1,-1)*bp;
  59.  
  60. def drawshadowed(text t) =
  61.   forsuffixes $=t:
  62.     fill bpath$ shifted shadowshift;
  63.     unfill bpath$;
  64.     drawboxed($);
  65.   endfor
  66. enddef;
  67.  
  68. boxit.a(btex \\s8A\\s+2 \\(lh a etex);
  69. circleit.b(btex $e sup {i omega t}$ etex rotated 20);
  70. b.w - a.e = (10bp,0);
  71. drawshadowed(a,b);
  72. draw a.e..b.w;
  73.  
  74. draw bbox currentpicture dashed evenly;
  75. endfig;
  76. .nr PS 11
  77. .nr VS 13
  78. .ft
  79. .fi
  80. .PP
  81. Note that the typesetting commands in the
  82. \f(CWbtex\fR.\|.\|.\f(CWetex\fR blocks in the above example are processed by
  83. .nf
  84. .ft CW
  85.              eqn -d\\$\\$ | troff;
  86. .ft
  87. .fi
  88. If a different \fItroff\fR pipeline is desired, it can be specified via the
  89. .ft CW
  90. TROFF
  91. .ft
  92. environment variable.  For example,
  93. .nf
  94. .ft CW
  95.              TROFF='tbl | eqn -d\\$\\$ | troff -Tpost'
  96. .ft
  97. .fi
  98. adds \fItbl\fR to the pipeline.
  99. .PP
  100. Macro definitions and such can be added via the standard
  101. \f(CWverbatimtex\fR.\|.\|.\f(CWetex\fR mechanism that adds the given material
  102. to the \fItroff\fR input.  Such material should not generate any output since
  103. this would get mixed up with the next \f(CWbtex\fR.\|.\|.\f(CWetex\fR block.
  104. Thus, newlines between \f(CWverbatimtex\fR and \f(CWetex\fR must be
  105. protected with \f(CW\\\fR.
  106.